-module(scene).
-export([get/0, new/0]).
-export([get_lights/1, add_light/2]).
-export([get_materials/1, add_material/2]).
-export([get_objects/1, add_object/2]).
-export([get_camera/1, set_camera/2]).
-export([get_ambient/1, set_ambient/2, get_background/1, set_background/2]).

-record(scene, {
        camera,
        lights=[],
        objects=[],
        materials=[],
        ambient=color:black(),
        background=color:black()
       }).

%Parse the scene
get() ->
    ase_parser:parse("misc/test.ASE").

% Create an empty scene
new() -> #scene{}.

% Lights
get_lights(Scene) -> Scene#scene.lights.
add_light(Light, Scene) -> Scene#scene{lights=[Light|Scene#scene.lights]}.

% Materials
get_materials(Scene) -> Scene#scene.materials.
add_material(Material, Scene) ->
    Scene#scene{materials=[Material|Scene#scene.materials]}.

% Objects
get_objects(Scene) -> Scene#scene.objects.
add_object(Object, Scene) -> Scene#scene{objects=[Object|Scene#scene.objects]}.

% Camera
set_camera(Camera, Scene) -> Scene#scene{camera=Camera}.
get_camera(Scene) -> Scene#scene.camera.

% Ambient light
get_ambient(Scene) -> Scene#scene.ambient.
set_ambient(Color, Scene) -> Scene#scene{ambient=Color}.

% Background color
get_background(Scene) -> Scene#scene.background.
set_background(Color, Scene) -> Scene#scene{background=Color}.